//
//  ArraySort.m
//  block
//
//  Created by admin on 2019/8/5.
//  Copyright © 2019 猫爷爷的酱醋茶. All rights reserved.
//

#import "ArraySort.h"
#import <string.h>

@implementation ArraySort

-(void)sortWithArray:(char *[])array andLength:(int)length andCompareBlock:(BOOL(^)(char * ObjectOne,char * ObjectTwo))compareBlock
{
    
    for (int i = 0; i < length - 1; i++)
    {
        for (int j = 0;j < length -1 -i ; j++)
        {
            BOOL res = compareBlock(array[j],array[j+1]);
            if(res == YES)
            {
                char *temp = array[j];
                array[j] = array[j+1];
                array[j+1] = temp;
            }
        }
    }
    
}

@end
